#include<bits/stdc++.h>
using namespace std;
#define MM 200005
#define x 1000001
int T;
int n;
int a[MM];
int b[MM];
int c[2]={1,8};

int main(){
    freopen("color.in","r",stdin);
    freopen("color.out","w",stdout);
    scanf("%d",&T);
    for(int i=0;i<T;i++){
        scanf("%d",&n);
        int bb=0;
        for(int j=1;j<=n;j++){
            scanf("%d",&a[j]);
            b[a[j]]++;
        }
        bool f=0;
        for(int j=1;j<=x;j++){
            if(b[j]>1){
                f=1;
                break;
            }
        }
        if(!f){
            cout << "0" << '\n';
        }else{
            cout << c[bb] << '\n';
            bb++;
        }
        if(bb==2)
            bb=0;
    }
    return 0;
}
